<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    
    <title>Linux 硬件信息获取 | jouyouyun&#39;s blog</title>
    <meta name="viewport" content="width=device-width,minimum-scale=1">
    <meta name="description" content="在 linux 上可以通过 dmidecode 或是 lshw 来获取硬件信息，能够方便的查看系统配置。但它们的输出信息过多，解析起来有些麻烦，另外 lshw 对 usb 接口的网卡支持不好，显示的信息不够，所以在此整理下通过读文件或是一些简单命令来获取硬件信息的方法。
DMI
一般情况下内核默认加载了 dmi sysfs ，路径是 /sys/class/dmi 。里面包含了 bios ， board ， product 等信息。">
    <meta name="generator" content="Hugo 0.105.0">
    
    
    
    
      <meta name="robots" content="noindex, nofollow">
    

    
<link rel="stylesheet" href="/ananke/css/main.min.css" >



    
    
    
      

    

    
    
    <meta property="og:title" content="Linux 硬件信息获取" />
<meta property="og:description" content="在 linux 上可以通过 dmidecode 或是 lshw 来获取硬件信息，能够方便的查看系统配置。但它们的输出信息过多，解析起来有些麻烦，另外 lshw 对 usb 接口的网卡支持不好，显示的信息不够，所以在此整理下通过读文件或是一些简单命令来获取硬件信息的方法。
DMI
一般情况下内核默认加载了 dmi sysfs ，路径是 /sys/class/dmi 。里面包含了 bios ， board ， product 等信息。" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://jouyouyun.github.io/post/linux_hardware_info/" /><meta property="article:section" content="post" />
<meta property="article:published_time" content="2019-05-08T17:50:00+08:00" />
<meta property="article:modified_time" content="2019-06-16T20:30:25+08:00" />

<meta itemprop="name" content="Linux 硬件信息获取">
<meta itemprop="description" content="在 linux 上可以通过 dmidecode 或是 lshw 来获取硬件信息，能够方便的查看系统配置。但它们的输出信息过多，解析起来有些麻烦，另外 lshw 对 usb 接口的网卡支持不好，显示的信息不够，所以在此整理下通过读文件或是一些简单命令来获取硬件信息的方法。
DMI
一般情况下内核默认加载了 dmi sysfs ，路径是 /sys/class/dmi 。里面包含了 bios ， board ， product 等信息。"><meta itemprop="datePublished" content="2019-05-08T17:50:00+08:00" />
<meta itemprop="dateModified" content="2019-06-16T20:30:25+08:00" />
<meta itemprop="wordCount" content="1500">
<meta itemprop="keywords" content="hardware,cpu,disk,network,wireless,wired,memory,dmi,bios,board,lsblk,lspci,lsusb,lshw,dmidecode," /><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Linux 硬件信息获取"/>
<meta name="twitter:description" content="在 linux 上可以通过 dmidecode 或是 lshw 来获取硬件信息，能够方便的查看系统配置。但它们的输出信息过多，解析起来有些麻烦，另外 lshw 对 usb 接口的网卡支持不好，显示的信息不够，所以在此整理下通过读文件或是一些简单命令来获取硬件信息的方法。
DMI
一般情况下内核默认加载了 dmi sysfs ，路径是 /sys/class/dmi 。里面包含了 bios ， board ， product 等信息。"/>

	
  </head>

  <body class="ma0 avenir bg-near-white">

    
   
  

  <header>
    <div class="bg-black">
      <nav class="pv3 ph3 ph4-ns" role="navigation">
  <div class="flex-l justify-between items-center center">
    <a href="/" class="f3 fw2 hover-white no-underline white-90 dib">
      
        jouyouyun&#39;s blog
      
    </a>
    <div class="flex-l items-center">
      

      
        <ul class="pl0 mr3">
          
          <li class="list f5 f4-ns fw4 dib pr3">
            <a class="hover-white no-underline white-90" href="/post/" title="Archives 页">
              Archives
            </a>
          </li>
          
          <li class="list f5 f4-ns fw4 dib pr3">
            <a class="hover-white no-underline white-90" href="/tags/" title="Tags 页">
              Tags
            </a>
          </li>
          
          <li class="list f5 f4-ns fw4 dib pr3">
            <a class="hover-white no-underline white-90" href="/categories/" title="Categories 页">
              Categories
            </a>
          </li>
          
        </ul>
      
      
<div class="ananke-socials">
  
    <a href="https://github.com/jouyouyun" target="_blank" class="github ananke-social-link link-transition stackoverflow link dib z-999 pt3 pt0-l mr1" title="GitHub link" rel="noopener" aria-label="follow on GitHub——Opens in a new window">
      
        <span class="icon"><svg style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512"  xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
  <path d="M256,32C132.3,32,32,134.8,32,261.7c0,101.5,64.2,187.5,153.2,217.9c11.2,2.1,15.3-5,15.3-11.1   c0-5.5-0.2-19.9-0.3-39.1c-62.3,13.9-75.5-30.8-75.5-30.8c-10.2-26.5-24.9-33.6-24.9-33.6c-20.3-14.3,1.5-14,1.5-14   c22.5,1.6,34.3,23.7,34.3,23.7c20,35.1,52.4,25,65.2,19.1c2-14.8,7.8-25,14.2-30.7c-49.7-5.8-102-25.5-102-113.5   c0-25.1,8.7-45.6,23-61.6c-2.3-5.8-10-29.2,2.2-60.8c0,0,18.8-6.2,61.6,23.5c17.9-5.1,37-7.6,56.1-7.7c19,0.1,38.2,2.6,56.1,7.7   c42.8-29.7,61.5-23.5,61.5-23.5c12.2,31.6,4.5,55,2.2,60.8c14.3,16.1,23,36.6,23,61.6c0,88.2-52.4,107.6-102.3,113.3   c8,7.1,15.2,21.1,15.2,42.5c0,30.7-0.3,55.5-0.3,63c0,6.1,4,13.3,15.4,11C415.9,449.1,480,363.1,480,261.7   C480,134.8,379.7,32,256,32z"/>
</svg>
</span>
      
<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000"  xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;"/>
</svg>
</span></a>
  
</div>

    </div>
  </div>
</nav>

    </div>
  </header>



    <main class="pb7" role="main">
      
  
  <article class="flex-l flex-wrap justify-between mw8 center ph3">
    <header class="mt4 w-100">
      <aside class="instapaper_ignoref b helvetica tracked">
          
        POSTS
      </aside>
      










  <div id="sharing" class="mt3 ananke-socials">
    
  </div>


      <h1 class="f1 athelas mt3 mb1">Linux 硬件信息获取</h1>
      
      <p class="tracked">
         <strong>jouyouyun</strong>
      </p>
      
      
      
      <time class="f6 mv4 dib tracked" datetime="2019-05-08T17:50:00+08:00">五月 8, 2019</time>
      

      
      
    </header>
    <div class="nested-copy-line-height lh-copy serif f4 nested-links mid-gray pr4-l w-two-thirds-l"><p>在 <code>linux</code> 上可以通过 <code>dmidecode</code> 或是 <code>lshw</code> 来获取硬件信息，能够方便的查看系统配置。但它们的输出信息过多，解析起来有些麻烦，另外 <code>lshw</code> 对 <code>usb</code> 接口的网卡支持不好，显示的信息不够，所以在此整理下通过读文件或是一些简单命令来获取硬件信息的方法。</p>
<h3 id="dmi"><strong>DMI</strong></h3>
<p>一般情况下内核默认加载了 <code>dmi sysfs</code> ，路径是 <code>/sys/class/dmi</code> 。里面包含了 <code>bios</code> ， <code>board</code> ， <code>product</code> 等信息。</p>
<h4 id="bios"><strong>Bios</strong></h4>
<p>通过命令 <code>ls -l /sys/class/dmi/id/bios_*</code> 可以看到支持的 <code>bios</code> 字段，如下：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ ls -l /sys/class/dmi/id/bios_*
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 17:18 /sys/class/dmi/id/bios_date
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 17:18 /sys/class/dmi/id/bios_vendor
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 17:18 /sys/class/dmi/id/bios_version
</span></span></code></pre></div><p>直接读文件即可获取对应值。</p>
<h4 id="board"><strong>Board</strong></h4>
<p>通过命令 <code>ls -l /sys/class/dmi/id/board_*</code> 可以看到支持的 <code>board</code> 字段，如下：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ ls -l /sys/class/dmi/id/board_*
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 08:45 /sys/class/dmi/id/board_asset_tag
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 08:45 /sys/class/dmi/id/board_name
</span></span><span style="display:flex;"><span>-r-------- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 08:45 /sys/class/dmi/id/board_serial
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 08:43 /sys/class/dmi/id/board_vendor
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 08:45 /sys/class/dmi/id/board_version
</span></span></code></pre></div><p>直接读文件即可获取对应值，但有些文件需要 <code>root</code> 权限。</p>
<h4 id="product"><strong>Product</strong></h4>
<p>通过命令 <code>ls -l /sys/class/dmi/id/product_*</code> 可以看到支持的 <code>product</code> 字段，如下：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ ls -l /sys/class/dmi/id/product_*
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 08:45 /sys/class/dmi/id/product_family
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 08:43 /sys/class/dmi/id/product_name
</span></span><span style="display:flex;"><span>-r-------- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 08:45 /sys/class/dmi/id/product_serial
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 17:12 /sys/class/dmi/id/product_sku
</span></span><span style="display:flex;"><span>-r-------- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 08:45 /sys/class/dmi/id/product_uuid
</span></span><span style="display:flex;"><span>-r--r--r-- <span style="color:#ae81ff">1</span> root root 4.0K 5月   <span style="color:#ae81ff">8</span> 08:45 /sys/class/dmi/id/product_version
</span></span></code></pre></div><p>直接读文件即可获取对应值，但有些文件需要 <code>root</code> 权限。</p>
<p>其中 <code>product_uuid</code> 可作为机器的唯一 <code>ID</code> 。</p>
<h3 id="cpu"><strong>CPU</strong></h3>
<p>通过读取文件 <code>/proc/cpuinfo</code> 可获取 <code>cpu</code> 的信息，一般 <code>model name</code> 字段为 <code>cpu</code> 名称，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ cat /proc/cpuinfo|grep <span style="color:#e6db74">&#39;model name&#39;</span>
</span></span><span style="display:flex;"><span>model name      : Intel<span style="color:#f92672">(</span>R<span style="color:#f92672">)</span> Core<span style="color:#f92672">(</span>TM<span style="color:#f92672">)</span> i7-3520M CPU @ 2.90GHz
</span></span><span style="display:flex;"><span>model name      : Intel<span style="color:#f92672">(</span>R<span style="color:#f92672">)</span> Core<span style="color:#f92672">(</span>TM<span style="color:#f92672">)</span> i7-3520M CPU @ 2.90GHz
</span></span><span style="display:flex;"><span>model name      : Intel<span style="color:#f92672">(</span>R<span style="color:#f92672">)</span> Core<span style="color:#f92672">(</span>TM<span style="color:#f92672">)</span> i7-3520M CPU @ 2.90GHz
</span></span><span style="display:flex;"><span>model name      : Intel<span style="color:#f92672">(</span>R<span style="color:#f92672">)</span> Core<span style="color:#f92672">(</span>TM<span style="color:#f92672">)</span> i7-3520M CPU @ 2.90GHz
</span></span></code></pre></div><p><strong>但在龙芯，申威上可能不是这个字段，需要根据文件内容确定。</strong></p>
<h3 id="memory"><strong>Memory</strong></h3>
<p>通过读取文件 <code>/proc/meminfo</code> 可获取内存总大小，字段是 <code>MemTotal</code> ，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ cat /proc/meminfo |grep MemTotal
</span></span><span style="display:flex;"><span>MemTotal:        <span style="color:#ae81ff">7860064</span> kB
</span></span></code></pre></div><p><strong>对于内存厂商等信息还未找到获取方法，待以后补全。</strong></p>
<h3 id="disk"><strong>Disk</strong></h3>
<p>硬盘信息这里使用 <code>lsblk</code> 来获取，通过指定它的参数来获取，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ lsblk -J -bno NAME,SERIAL,TYPE,SIZE,VENDOR,MODEL,MOUNTPOINT,UUID
</span></span><span style="display:flex;"><span><span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>   <span style="color:#e6db74">&#34;blockdevices&#34;</span>: <span style="color:#f92672">[</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">{</span><span style="color:#e6db74">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;sda&#34;</span>, <span style="color:#e6db74">&#34;serial&#34;</span>: <span style="color:#e6db74">&#34;TF0500WE0GAV0V&#34;</span>, <span style="color:#e6db74">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;disk&#34;</span>, <span style="color:#e6db74">&#34;size&#34;</span>: <span style="color:#e6db74">&#34;500107862016&#34;</span>, <span style="color:#e6db74">&#34;vendor&#34;</span>: <span style="color:#e6db74">&#34;ATA     &#34;</span>, <span style="color:#e6db74">&#34;model&#34;</span>: <span style="color:#e6db74">&#34;HGST HTS725050A7&#34;</span>, <span style="color:#e6db74">&#34;mountpoint&#34;</span>: null,
</span></span><span style="display:flex;"><span>         <span style="color:#e6db74">&#34;children&#34;</span>: <span style="color:#f92672">[</span>
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">{</span><span style="color:#e6db74">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;sda1&#34;</span>, <span style="color:#e6db74">&#34;serial&#34;</span>: null, <span style="color:#e6db74">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;part&#34;</span>, <span style="color:#e6db74">&#34;size&#34;</span>: <span style="color:#e6db74">&#34;4294967296&#34;</span>, <span style="color:#e6db74">&#34;vendor&#34;</span>: null, <span style="color:#e6db74">&#34;model&#34;</span>: null, <span style="color:#e6db74">&#34;mountpoint&#34;</span>: <span style="color:#e6db74">&#34;/boot&#34;</span><span style="color:#f92672">}</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">{</span><span style="color:#e6db74">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;sda2&#34;</span>, <span style="color:#e6db74">&#34;serial&#34;</span>: null, <span style="color:#e6db74">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;part&#34;</span>, <span style="color:#e6db74">&#34;size&#34;</span>: <span style="color:#e6db74">&#34;4294967296&#34;</span>, <span style="color:#e6db74">&#34;vendor&#34;</span>: null, <span style="color:#e6db74">&#34;model&#34;</span>: null, <span style="color:#e6db74">&#34;mountpoint&#34;</span>: <span style="color:#e6db74">&#34;[SWAP]&#34;</span><span style="color:#f92672">}</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">{</span><span style="color:#e6db74">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;sda3&#34;</span>, <span style="color:#e6db74">&#34;serial&#34;</span>: null, <span style="color:#e6db74">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;part&#34;</span>, <span style="color:#e6db74">&#34;size&#34;</span>: <span style="color:#e6db74">&#34;1024&#34;</span>, <span style="color:#e6db74">&#34;vendor&#34;</span>: null, <span style="color:#e6db74">&#34;model&#34;</span>: null, <span style="color:#e6db74">&#34;mountpoint&#34;</span>: null<span style="color:#f92672">}</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">{</span><span style="color:#e6db74">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;sda5&#34;</span>, <span style="color:#e6db74">&#34;serial&#34;</span>: null, <span style="color:#e6db74">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;part&#34;</span>, <span style="color:#e6db74">&#34;size&#34;</span>: <span style="color:#e6db74">&#34;107374182400&#34;</span>, <span style="color:#e6db74">&#34;vendor&#34;</span>: null, <span style="color:#e6db74">&#34;model&#34;</span>: null, <span style="color:#e6db74">&#34;mountpoint&#34;</span>: <span style="color:#e6db74">&#34;/Data&#34;</span><span style="color:#f92672">}</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">{</span><span style="color:#e6db74">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;sda6&#34;</span>, <span style="color:#e6db74">&#34;serial&#34;</span>: null, <span style="color:#e6db74">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;part&#34;</span>, <span style="color:#e6db74">&#34;size&#34;</span>: <span style="color:#e6db74">&#34;64424509440&#34;</span>, <span style="color:#e6db74">&#34;vendor&#34;</span>: null, <span style="color:#e6db74">&#34;model&#34;</span>: null, <span style="color:#e6db74">&#34;mountpoint&#34;</span>: <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>         <span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span></code></pre></div><p>参数的含义通过 <code>lsblk -h</code> 命令查看。</p>
<p><strong>只有 <code>type</code> 为 <code>disk</code> 时才表示为一块硬盘，其它如 <code>loop</code> 则应该过滤掉。</strong> 每块硬盘中的 <code>children</code> 表示它下面的分区，通过 <code>mountpoint</code> 可确定硬盘在此系统上的使用情况。</p>
<h3 id="network"><strong>Network</strong></h3>
<p>这里是先获取系统上的网络接口，这包括了物理网卡和虚拟网卡(如 <code>docker</code> 创建的)。</p>
<p><del>所以要先过滤，过滤顺序如下：</del></p>
<p><del>1. 按名字过滤</del></p>
<p><del>过滤掉 <code>lo</code></del></p>
<p><del>2. 按驱动过滤</del></p>
<p><del>过滤掉驱动为 <code>dummy, veth, vboxnet, vmnet, vmxnet, vmxnet2, vmxnet3</code> 的网卡, 虚拟机中的</del></p>
<p><del>3. 按网卡类型过滤</del></p>
<p><del>过滤掉 <code>bridge</code> 类型的网卡</del></p>
<p>如果网卡接口同时存在于 <code>/sys/class/net/</code> 和 <code>/sys/devices/virtual/net/</code> 中，则需要过滤掉。</p>
<p>接下来分别给出网卡信息获取的方法：</p>
<h4 id="interface-name"><strong>Interface Name</strong></h4>
<p>即是上面的目录下的子目录名</p>
<h4 id="mac-address"><strong>Mac Address</strong></h4>
<p>读取文件 <code>/sys/class/net/&lt;iface name&gt;/address</code> 可得到</p>
<h4 id="ip"><strong>IP</strong></h4>
<p>通过调用 <code>ioctl</code> 来获取指定 <code>iface name</code> 的 <code>ip</code> ，代码大致如下：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>char* get_ip_for_iface<span style="color:#f92672">(</span>char *iface<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    int fd;
</span></span><span style="display:flex;"><span>    struct ifreq ifr;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    fd <span style="color:#f92672">=</span> socket<span style="color:#f92672">(</span>AF_INET, SOCK_DGRAM, 0<span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> <span style="color:#f92672">(</span>fd <span style="color:#f92672">==</span> -1<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>        fprintf<span style="color:#f92672">(</span>stderr, <span style="color:#e6db74">&#34;open socket failed: %s&#34;</span>, strerror<span style="color:#f92672">(</span>errno<span style="color:#f92672">))</span>;
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">return</span>;
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    // must init ifr
</span></span><span style="display:flex;"><span>    memset<span style="color:#f92672">(</span>&amp;ifr, 0, sizeof<span style="color:#f92672">(</span>ifr<span style="color:#f92672">))</span>;
</span></span><span style="display:flex;"><span>    ifr.ifr_addr.sa_family <span style="color:#f92672">=</span> AF_INET;
</span></span><span style="display:flex;"><span>    strncpy<span style="color:#f92672">(</span>ifr.ifr_name, name.c_str<span style="color:#f92672">()</span>, IFNAMSIZ - 1<span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span>    ioctl<span style="color:#f92672">(</span>fd, SIOCGIFADDR, &amp;ifr<span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span>    close<span style="color:#f92672">(</span>fd<span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    char *c_addr <span style="color:#f92672">=</span> inet_ntoa<span style="color:#f92672">(((</span>struct sockaddr_in *<span style="color:#f92672">)</span>&amp;ifr.ifr_addr<span style="color:#f92672">)</span>-&gt;sin_addr<span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span>    char *ip <span style="color:#f92672">=</span> calloc<span style="color:#f92672">(</span>strlen<span style="color:#f92672">(</span>c_addr<span style="color:#f92672">)</span>+1, sizeof<span style="color:#f92672">(</span>char<span style="color:#f92672">))</span>;
</span></span><span style="display:flex;"><span>    memcpy<span style="color:#f92672">(</span>ip, c_addr, strlen<span style="color:#f92672">(</span>c_addr<span style="color:#f92672">))</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> ip;
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span></code></pre></div><p><code>ipv6</code> 的暂未测试。</p>
<h4 id="model"><strong>Model</strong></h4>
<p>网卡一般在 <code>pci</code> 接口上，但也有些实在 <code>usb</code> 接口上，要分别获取。</p>
<p>不过都要先读取文件 <code>/sys/class/net/enp0s25/device/uevent</code> ，然后分别处理。</p>
<ul>
<li>
<p><strong>pci</strong></p>
<p><code>uevent</code> 内容如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>DRIVER<span style="color:#f92672">=</span>e1000e
</span></span><span style="display:flex;"><span>PCI_CLASS<span style="color:#f92672">=</span><span style="color:#ae81ff">20000</span>
</span></span><span style="display:flex;"><span>PCI_ID<span style="color:#f92672">=</span>8086:1502
</span></span><span style="display:flex;"><span>PCI_SUBSYS_ID<span style="color:#f92672">=</span>17AA:21F3
</span></span><span style="display:flex;"><span>PCI_SLOT_NAME<span style="color:#f92672">=</span>0000:00:19.0
</span></span><span style="display:flex;"><span>MODALIAS<span style="color:#f92672">=</span>pci:v00008086d00001502sv000017AAsd000021F3bc02sc00i00
</span></span></code></pre></div><p>取到其中的 <code>PCI_SLOT_NAME</code> ，然后执行 <code>lspci -k -s &lt;PCI_SLOT_NAME&gt;</code> 来获取 <code>model</code> 信息，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ lspci -k -s 0000:00:19.0
</span></span><span style="display:flex;"><span>00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection <span style="color:#f92672">(</span>Lewisville<span style="color:#f92672">)</span> <span style="color:#f92672">(</span>rev 04<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>        Subsystem: Lenovo 82579LM Gigabit Network Connection
</span></span><span style="display:flex;"><span>        Kernel driver in use: e1000e
</span></span><span style="display:flex;"><span>        Kernel modules: e1000e
</span></span></code></pre></div><p>其中 <code>Subsystem</code> 之后的即是 <code>model</code> 信息。</p>
</li>
<li>
<p><strong>usb</strong></p>
<p><code>uevent</code> 内容如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>DEVTYPE<span style="color:#f92672">=</span>usb_interface
</span></span><span style="display:flex;"><span>DRIVER<span style="color:#f92672">=</span>ath9k_htc
</span></span><span style="display:flex;"><span>PRODUCT<span style="color:#f92672">=</span>cf3/9271/108
</span></span><span style="display:flex;"><span>TYPE<span style="color:#f92672">=</span>255/255/255
</span></span><span style="display:flex;"><span>INTERFACE<span style="color:#f92672">=</span>255/0/0
</span></span><span style="display:flex;"><span>MODALIAS<span style="color:#f92672">=</span>usb:v0CF3p9271d0108dcFFdscFFdpFFicFFisc00ip00in00
</span></span></code></pre></div><p>取到其中的 <code>PRODUCT</code> ，然后将 <code>/</code> 替换为 <code>:</code> ，然后执行 <code>lsusb -d &lt;product&gt;</code> 来获取 <code>model</code> 信息，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#75715e"># 可以不要最后的 &#39;108&#39;</span>
</span></span><span style="display:flex;"><span>$ lsusb -d cf3:9271:108
</span></span><span style="display:flex;"><span>Bus <span style="color:#ae81ff">001</span> Device 007: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
</span></span></code></pre></div><p>其中 <code>Subsystem</code> 之后的即是 <code>model</code> 信息。</p>
</li>
</ul>
<h3 id="bluetooth"><strong>Bluetooth</strong></h3>
<p>在 <code>/sys/class/bluetooth/</code> 下是蓝牙设备，与 <strong>网卡</strong> 一样，根据 <code>/sys/class/bluetooth/&lt;hciX&gt;/device/uevent</code> 的内容使用 <code>lspci</code> 或 <code>lsusb</code> 来获取 <code>model</code> 信息。</p>
<p>如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ cat /sys/class/bluetooth/hci0/device/uevent
</span></span><span style="display:flex;"><span>DEVTYPE<span style="color:#f92672">=</span>usb_interface
</span></span><span style="display:flex;"><span>DRIVER<span style="color:#f92672">=</span>btusb
</span></span><span style="display:flex;"><span>PRODUCT<span style="color:#f92672">=</span>a5c/21e6/112
</span></span><span style="display:flex;"><span>TYPE<span style="color:#f92672">=</span>255/1/1
</span></span><span style="display:flex;"><span>INTERFACE<span style="color:#f92672">=</span>255/1/1
</span></span><span style="display:flex;"><span>MODALIAS<span style="color:#f92672">=</span>usb:v0A5Cp21E6d0112dcFFdsc01dp01icFFisc01ip01in00
</span></span></code></pre></div><p>这就是一个 <code>usb</code> 接口的设备，所以使用 <code>lsusb</code> 来获取 <code>model</code> 信息，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ lsusb -d a5c:21e6:112
</span></span><span style="display:flex;"><span>Bus <span style="color:#ae81ff">001</span> Device 003: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 <span style="color:#f92672">[</span>ThinkPad<span style="color:#f92672">]</span>
</span></span></code></pre></div><h3 id="graphic"><strong>Graphic</strong></h3>
<p>显卡信息在 <code>/sys/class/drm/</code> 下，里面还包含了显卡支持输出接口，但只有 <code>card+integer</code> 组成的目录才是显卡的，如本机的信息：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ ls /sys/class/drm/
</span></span><span style="display:flex;"><span>card0@  card0-DP-1@  card0-DP-2@  card0-DP-3@  card0-HDMI-A-1@  card0-HDMI-A-2@  card0-HDMI-A-3@  card0-LVDS-1@  card0-VGA-1@  renderD128@  version
</span></span></code></pre></div><p>根据输出可知只有一块显卡 <code>card0</code> ，通过读取文件 <code>card0/device/uevent</code> 获取设备类型，然后同 <strong>网卡</strong> 一样查询 <code>model</code> 信息，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ cat /sys/class/drm/card0/device/uevent
</span></span><span style="display:flex;"><span>DRIVER<span style="color:#f92672">=</span>i915
</span></span><span style="display:flex;"><span>PCI_CLASS<span style="color:#f92672">=</span><span style="color:#ae81ff">30000</span>
</span></span><span style="display:flex;"><span>PCI_ID<span style="color:#f92672">=</span>8086:0166
</span></span><span style="display:flex;"><span>PCI_SUBSYS_ID<span style="color:#f92672">=</span>17AA:21FA
</span></span><span style="display:flex;"><span>PCI_SLOT_NAME<span style="color:#f92672">=</span>0000:00:02.0
</span></span><span style="display:flex;"><span>MODALIAS<span style="color:#f92672">=</span>pci:v00008086d00000166sv000017AAsd000021FAbc03sc00i00
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>$ lspci -k -s 0000:00:02.0
</span></span><span style="display:flex;"><span>00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller <span style="color:#f92672">(</span>rev 09<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>        Subsystem: Lenovo 3rd Gen Core processor Graphics Controller
</span></span><span style="display:flex;"><span>        Kernel driver in use: i915
</span></span><span style="display:flex;"><span>        Kernel modules: i915
</span></span></code></pre></div><p>另外 <code>/sys/class/hwmon/</code> 和 <code>/sys/class/graphics/</code> 下有当前使用中的显卡设备，也是对应子目录下的 <code>device/uevent</code> 来获取信息。</p>
<p>若无 <code>device</code> 目录或是 <code>device/uevent</code> 中的内容既没有 <code>pci</code> 信息也没有 <code>usb</code> 信息，则过滤掉，有就如下所示获取：</p>
<p><strong><code>hwmon</code></strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ cat /sys/class/hwmon/hwmon2/device/uevent
</span></span><span style="display:flex;"><span>DRIVER<span style="color:#f92672">=</span>nouveau
</span></span><span style="display:flex;"><span>PCI_CLASS<span style="color:#f92672">=</span><span style="color:#ae81ff">30000</span>
</span></span><span style="display:flex;"><span>PCI_ID<span style="color:#f92672">=</span>10DE:0A75
</span></span><span style="display:flex;"><span>PCI_SUBSYS_ID<span style="color:#f92672">=</span>17AA:3957
</span></span><span style="display:flex;"><span>PCI_SLOT_NAME<span style="color:#f92672">=</span>0000:02:00.0
</span></span><span style="display:flex;"><span>MODALIAS<span style="color:#f92672">=</span>pci:v000010DEd00000A75sv000017AAsd00003957bc03sc00i00
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>$ lspci -k -s 0000:02:00.0
</span></span><span style="display:flex;"><span>02:00.0 VGA compatible controller: NVIDIA Corporation GT218M <span style="color:#f92672">[</span>GeForce 310M<span style="color:#f92672">]</span> <span style="color:#f92672">(</span>rev a2<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>        Subsystem: Lenovo GT218M <span style="color:#f92672">[</span>GeForce 310M<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>        Kernel driver in use: nouveau
</span></span><span style="display:flex;"><span>        Kernel modules: nouveau
</span></span></code></pre></div><p><strong><code>graphics</code></strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ cat /sys/class/graphics/fb0/device/uevent
</span></span><span style="display:flex;"><span>DRIVER<span style="color:#f92672">=</span>i915
</span></span><span style="display:flex;"><span>PCI_CLASS<span style="color:#f92672">=</span><span style="color:#ae81ff">30000</span>
</span></span><span style="display:flex;"><span>PCI_ID<span style="color:#f92672">=</span>8086:0166
</span></span><span style="display:flex;"><span>PCI_SUBSYS_ID<span style="color:#f92672">=</span>17AA:21FA
</span></span><span style="display:flex;"><span>PCI_SLOT_NAME<span style="color:#f92672">=</span>0000:00:02.0
</span></span><span style="display:flex;"><span>MODALIAS<span style="color:#f92672">=</span>pci:v00008086d00000166sv000017AAsd000021FAbc03sc00i00
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>$ lspci -k -s 0000:00:02.0
</span></span><span style="display:flex;"><span>00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller <span style="color:#f92672">(</span>rev 09<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>        Subsystem: Lenovo 3rd Gen Core processor Graphics Controller
</span></span><span style="display:flex;"><span>        Kernel driver in use: i915
</span></span><span style="display:flex;"><span>        Kernel modules: i915
</span></span></code></pre></div><h4 id="display-monitor">Display Monitor</h4>
<p>显示器的信息目前是从 <code>edid</code> 中获取，先确定显示器连接的显卡端口，然后使用 <code>edid-decode</code> (需要安装)解析其的 <code>edid</code> 文件，就可得到详细信息。如本机是 <code>card0-LVDS-1</code> ：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ cat /sys/class/drm/card0-LVDS-1/edid|edid-decode
</span></span><span style="display:flex;"><span>Extracted contents:
</span></span><span style="display:flex;"><span>header:          <span style="color:#ae81ff">00</span> ff ff ff ff ff ff <span style="color:#ae81ff">00</span>
</span></span><span style="display:flex;"><span>serial number:   <span style="color:#ae81ff">06</span> af 6c <span style="color:#ae81ff">10</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">14</span>
</span></span><span style="display:flex;"><span>version:         <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">04</span>
</span></span><span style="display:flex;"><span>basic params:    <span style="color:#ae81ff">90</span> 1c <span style="color:#ae81ff">10</span> <span style="color:#ae81ff">78</span> <span style="color:#ae81ff">02</span>
</span></span><span style="display:flex;"><span>chroma info:     <span style="color:#ae81ff">20</span> e5 <span style="color:#ae81ff">92</span> <span style="color:#ae81ff">55</span> <span style="color:#ae81ff">54</span> <span style="color:#ae81ff">92</span> <span style="color:#ae81ff">28</span> <span style="color:#ae81ff">25</span> <span style="color:#ae81ff">50</span> <span style="color:#ae81ff">54</span>
</span></span><span style="display:flex;"><span>established:     <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span>
</span></span><span style="display:flex;"><span>standard:        <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span> <span style="color:#ae81ff">01</span>
</span></span><span style="display:flex;"><span>descriptor 1:    <span style="color:#ae81ff">12</span> 1b <span style="color:#ae81ff">56</span> <span style="color:#ae81ff">58</span> <span style="color:#ae81ff">50</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">19</span> <span style="color:#ae81ff">30</span> <span style="color:#ae81ff">30</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">36</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">15</span> 9c <span style="color:#ae81ff">10</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">18</span>
</span></span><span style="display:flex;"><span>descriptor 2:    <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> 0f <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">20</span>
</span></span><span style="display:flex;"><span>descriptor 3:    <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> fe <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">41</span> <span style="color:#ae81ff">55</span> 4f 0a <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">20</span>
</span></span><span style="display:flex;"><span>descriptor 4:    <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">00</span> fe <span style="color:#ae81ff">00</span> <span style="color:#ae81ff">42</span> <span style="color:#ae81ff">31</span> <span style="color:#ae81ff">32</span> <span style="color:#ae81ff">35</span> <span style="color:#ae81ff">58</span> <span style="color:#ae81ff">57</span> <span style="color:#ae81ff">30</span> <span style="color:#ae81ff">31</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">56</span> <span style="color:#ae81ff">30</span> <span style="color:#ae81ff">20</span> 0a
</span></span><span style="display:flex;"><span>extensions:      <span style="color:#ae81ff">00</span>
</span></span><span style="display:flex;"><span>checksum:        ec
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Manufacturer: AUO Model 106c Serial Number <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>Made week <span style="color:#ae81ff">0</span> of <span style="color:#ae81ff">2010</span>
</span></span><span style="display:flex;"><span>EDID version: 1.4
</span></span><span style="display:flex;"><span>Digital display
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">6</span> bits per primary color channel
</span></span><span style="display:flex;"><span>Digital interface is not defined
</span></span><span style="display:flex;"><span>Maximum image size: <span style="color:#ae81ff">28</span> cm x <span style="color:#ae81ff">16</span> cm
</span></span><span style="display:flex;"><span>Gamma: 2.20
</span></span><span style="display:flex;"><span>Supported color formats: RGB 4:4:4
</span></span><span style="display:flex;"><span>First detailed timing is preferred timing
</span></span><span style="display:flex;"><span>Established timings supported:
</span></span><span style="display:flex;"><span>Standard timings supported:
</span></span><span style="display:flex;"><span>Detailed mode: Clock 69.300 MHz, <span style="color:#ae81ff">277</span> mm x <span style="color:#ae81ff">156</span> mm
</span></span><span style="display:flex;"><span>               <span style="color:#ae81ff">1366</span> <span style="color:#ae81ff">1414</span> <span style="color:#ae81ff">1446</span> <span style="color:#ae81ff">1454</span> hborder <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>                <span style="color:#ae81ff">768</span>  <span style="color:#ae81ff">771</span>  <span style="color:#ae81ff">777</span>  <span style="color:#ae81ff">793</span> vborder <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>               -hsync -vsync
</span></span><span style="display:flex;"><span>Manufacturer-specified data, tag <span style="color:#ae81ff">15</span>
</span></span><span style="display:flex;"><span>ASCII string: AUO
</span></span><span style="display:flex;"><span>ASCII string: B125XW01
</span></span><span style="display:flex;"><span>Checksum: 0xec <span style="color:#f92672">(</span>valid<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>EDID block does NOT conform to EDID 1.3!
</span></span><span style="display:flex;"><span>        Missing name descriptor
</span></span><span style="display:flex;"><span>        Missing monitor ranges
</span></span><span style="display:flex;"><span>        Detailed block string not properly terminated
</span></span></code></pre></div><h3 id="sound">Sound</h3>
<p>声卡设备在 <code>/sys/class/sound</code> 目录下，目录名一般是 <code>card+integer</code> 组成，如本机的信息：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ ls /sys/class/sound/
</span></span><span style="display:flex;"><span>card0@  controlC0@  hwC0D0@  hwC0D3@  pcmC0D0c@  pcmC0D0p@  pcmC0D3p@  pcmC0D7p@  pcmC0D8p@  timer@
</span></span></code></pre></div><p>就只有一块声卡 <code>card0</code> ，通过读取文件 <code>card0/device/uevent</code> 获取设备类型，然后同 <strong>网卡</strong> 一样查询 <code>model</code> 信息，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ cat /sys/class/sound/card0/device/uevent
</span></span><span style="display:flex;"><span>DRIVER<span style="color:#f92672">=</span>snd_hda_intel
</span></span><span style="display:flex;"><span>PCI_CLASS<span style="color:#f92672">=</span><span style="color:#ae81ff">40300</span>
</span></span><span style="display:flex;"><span>PCI_ID<span style="color:#f92672">=</span>8086:1E20
</span></span><span style="display:flex;"><span>PCI_SUBSYS_ID<span style="color:#f92672">=</span>17AA:21FA
</span></span><span style="display:flex;"><span>PCI_SLOT_NAME<span style="color:#f92672">=</span>0000:00:1b.0
</span></span><span style="display:flex;"><span>MODALIAS<span style="color:#f92672">=</span>pci:v00008086d00001E20sv000017AAsd000021FAbc04sc03i00
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>$ lspci -k -s 0000:00:1b.0
</span></span><span style="display:flex;"><span>00:1b.0 Audio device: Intel Corporation <span style="color:#ae81ff">7</span> Series/C216 Chipset Family High Definition Audio Controller <span style="color:#f92672">(</span>rev 04<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>        Subsystem: Lenovo <span style="color:#ae81ff">7</span> Series/C216 Chipset Family High Definition Audio Controller
</span></span><span style="display:flex;"><span>        Kernel driver in use: snd_hda_intel
</span></span><span style="display:flex;"><span>        Kernel modules: snd_hda_intel
</span></span></code></pre></div><h3 id="input-output-device"><strong>Input/Output Device</strong></h3>
<p>输入设备的信息可以从 <code>/proc/bus/input/devices</code> 文件中获取，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>I: Bus<span style="color:#f92672">=</span><span style="color:#ae81ff">0019</span> Vendor<span style="color:#f92672">=</span><span style="color:#ae81ff">0000</span> Product<span style="color:#f92672">=</span><span style="color:#ae81ff">0005</span> Version<span style="color:#f92672">=</span><span style="color:#ae81ff">0000</span>
</span></span><span style="display:flex;"><span>N: Name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;Lid Switch&#34;</span>
</span></span><span style="display:flex;"><span>P: Phys<span style="color:#f92672">=</span>PNP0C0D/button/input0
</span></span><span style="display:flex;"><span>S: Sysfs<span style="color:#f92672">=</span>/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0
</span></span><span style="display:flex;"><span>U: Uniq<span style="color:#f92672">=</span>
</span></span><span style="display:flex;"><span>H: Handlers<span style="color:#f92672">=</span>event0
</span></span><span style="display:flex;"><span>B: PROP<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>B: EV<span style="color:#f92672">=</span><span style="color:#ae81ff">21</span>
</span></span><span style="display:flex;"><span>B: SW<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>I: Bus<span style="color:#f92672">=</span><span style="color:#ae81ff">0011</span> Vendor<span style="color:#f92672">=</span><span style="color:#ae81ff">0001</span> Product<span style="color:#f92672">=</span><span style="color:#ae81ff">0001</span> Version<span style="color:#f92672">=</span>ab54
</span></span><span style="display:flex;"><span>N: Name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;AT Translated Set 2 keyboard&#34;</span>
</span></span><span style="display:flex;"><span>P: Phys<span style="color:#f92672">=</span>isa0060/serio0/input0
</span></span><span style="display:flex;"><span>S: Sysfs<span style="color:#f92672">=</span>/devices/platform/i8042/serio0/input/input3
</span></span><span style="display:flex;"><span>U: Uniq<span style="color:#f92672">=</span>
</span></span><span style="display:flex;"><span>H: Handlers<span style="color:#f92672">=</span>sysrq kbd event3 leds
</span></span><span style="display:flex;"><span>B: PROP<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>B: EV<span style="color:#f92672">=</span><span style="color:#ae81ff">120013</span>
</span></span><span style="display:flex;"><span>B: KEY<span style="color:#f92672">=</span><span style="color:#ae81ff">10000</span> <span style="color:#ae81ff">0</span> <span style="color:#ae81ff">0</span> <span style="color:#ae81ff">0</span> <span style="color:#ae81ff">1000402000000</span> 3803078f800d001 feffffdfffefffff fffffffffffffffe
</span></span><span style="display:flex;"><span>B: MSC<span style="color:#f92672">=</span><span style="color:#ae81ff">10</span>
</span></span><span style="display:flex;"><span>B: LED<span style="color:#f92672">=</span><span style="color:#ae81ff">7</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>I: Bus<span style="color:#f92672">=</span><span style="color:#ae81ff">0011</span> Vendor<span style="color:#f92672">=</span><span style="color:#ae81ff">0002</span> Product<span style="color:#f92672">=</span><span style="color:#ae81ff">0007</span> Version<span style="color:#f92672">=</span>01b1
</span></span><span style="display:flex;"><span>N: Name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;SynPS/2 Synaptics TouchPad&#34;</span>
</span></span><span style="display:flex;"><span>P: Phys<span style="color:#f92672">=</span>isa0060/serio1/input0
</span></span><span style="display:flex;"><span>S: Sysfs<span style="color:#f92672">=</span>/devices/platform/i8042/serio1/input/input5
</span></span><span style="display:flex;"><span>U: Uniq<span style="color:#f92672">=</span>
</span></span><span style="display:flex;"><span>H: Handlers<span style="color:#f92672">=</span>mouse0 event5
</span></span><span style="display:flex;"><span>B: PROP<span style="color:#f92672">=</span><span style="color:#ae81ff">5</span>
</span></span><span style="display:flex;"><span>B: EV<span style="color:#f92672">=</span>b
</span></span><span style="display:flex;"><span>B: KEY<span style="color:#f92672">=</span>e520 <span style="color:#ae81ff">10000</span> <span style="color:#ae81ff">0</span> <span style="color:#ae81ff">0</span> <span style="color:#ae81ff">0</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>B: ABS<span style="color:#f92672">=</span><span style="color:#ae81ff">660800011000003</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>...
</span></span></code></pre></div><p>由于内容太多，这里就只显示部分内容。</p>
<p>另外也可通过 <code>xinput</code> 命令获取，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ xinput
</span></span><span style="display:flex;"><span>⎡ Virtual core pointer                          id<span style="color:#f92672">=</span><span style="color:#ae81ff">2</span>    <span style="color:#f92672">[</span>master pointer  <span style="color:#f92672">(</span>3<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>⎜   ↳ Virtual core XTEST pointer                id<span style="color:#f92672">=</span><span style="color:#ae81ff">4</span>    <span style="color:#f92672">[</span>slave  pointer  <span style="color:#f92672">(</span>2<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>⎜   ↳ SynPS/2 Synaptics TouchPad                id<span style="color:#f92672">=</span><span style="color:#ae81ff">11</span>   <span style="color:#f92672">[</span>slave  pointer  <span style="color:#f92672">(</span>2<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>⎜   ↳ TPPS/2 IBM TrackPoint                     id<span style="color:#f92672">=</span><span style="color:#ae81ff">12</span>   <span style="color:#f92672">[</span>slave  pointer  <span style="color:#f92672">(</span>2<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>⎣ Virtual core keyboard                         id<span style="color:#f92672">=</span><span style="color:#ae81ff">3</span>    <span style="color:#f92672">[</span>master keyboard <span style="color:#f92672">(</span>2<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>    ↳ Virtual core XTEST keyboard               id<span style="color:#f92672">=</span><span style="color:#ae81ff">5</span>    <span style="color:#f92672">[</span>slave  keyboard <span style="color:#f92672">(</span>3<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>    ↳ Power Button                              id<span style="color:#f92672">=</span><span style="color:#ae81ff">6</span>    <span style="color:#f92672">[</span>slave  keyboard <span style="color:#f92672">(</span>3<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>    ↳ Video Bus                                 id<span style="color:#f92672">=</span><span style="color:#ae81ff">7</span>    <span style="color:#f92672">[</span>slave  keyboard <span style="color:#f92672">(</span>3<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>    ↳ Sleep Button                              id<span style="color:#f92672">=</span><span style="color:#ae81ff">8</span>    <span style="color:#f92672">[</span>slave  keyboard <span style="color:#f92672">(</span>3<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>    ↳ Integrated Camera: Integrated C           id<span style="color:#f92672">=</span><span style="color:#ae81ff">9</span>    <span style="color:#f92672">[</span>slave  keyboard <span style="color:#f92672">(</span>3<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>    ↳ AT Translated Set <span style="color:#ae81ff">2</span> keyboard              id<span style="color:#f92672">=</span><span style="color:#ae81ff">10</span>   <span style="color:#f92672">[</span>slave  keyboard <span style="color:#f92672">(</span>3<span style="color:#f92672">)]</span>
</span></span><span style="display:flex;"><span>    ↳ ThinkPad Extra Buttons                    id<span style="color:#f92672">=</span><span style="color:#ae81ff">13</span>   <span style="color:#f92672">[</span>slave  keyboard <span style="color:#f92672">(</span>3<span style="color:#f92672">)]</span>
</span></span></code></pre></div><p>使用 <code>xinput list-prop &lt;device id&gt;</code> 可以查看设备的属性。</p>
<h3 id="battery"><strong>Battery</strong></h3>
<p>电池信息可以从 <code>/sys/class/power_supply/&lt;name&gt;/uevent</code> 文件中获取，电池的名称一般以 <code>BAT</code> 开头。如本机的信息：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ cat /sys/class/power_supply/BAT0/uevent
</span></span><span style="display:flex;"><span>POWER_SUPPLY_NAME<span style="color:#f92672">=</span>BAT0
</span></span><span style="display:flex;"><span>POWER_SUPPLY_STATUS<span style="color:#f92672">=</span>Full
</span></span><span style="display:flex;"><span>POWER_SUPPLY_PRESENT<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>POWER_SUPPLY_TECHNOLOGY<span style="color:#f92672">=</span>Li-ion
</span></span><span style="display:flex;"><span>POWER_SUPPLY_CYCLE_COUNT<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>POWER_SUPPLY_VOLTAGE_MIN_DESIGN<span style="color:#f92672">=</span><span style="color:#ae81ff">11100000</span>
</span></span><span style="display:flex;"><span>POWER_SUPPLY_VOLTAGE_NOW<span style="color:#f92672">=</span><span style="color:#ae81ff">12226000</span>
</span></span><span style="display:flex;"><span>POWER_SUPPLY_POWER_NOW<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>POWER_SUPPLY_ENERGY_FULL_DESIGN<span style="color:#f92672">=</span><span style="color:#ae81ff">57720000</span>
</span></span><span style="display:flex;"><span>POWER_SUPPLY_ENERGY_FULL<span style="color:#f92672">=</span><span style="color:#ae81ff">48000000</span>
</span></span><span style="display:flex;"><span>POWER_SUPPLY_ENERGY_NOW<span style="color:#f92672">=</span><span style="color:#ae81ff">48000000</span>
</span></span><span style="display:flex;"><span>POWER_SUPPLY_CAPACITY<span style="color:#f92672">=</span><span style="color:#ae81ff">100</span>
</span></span><span style="display:flex;"><span>POWER_SUPPLY_CAPACITY_LEVEL<span style="color:#f92672">=</span>Full
</span></span><span style="display:flex;"><span>POWER_SUPPLY_MODEL_NAME<span style="color:#f92672">=</span>45N1023
</span></span><span style="display:flex;"><span>POWER_SUPPLY_MANUFACTURER<span style="color:#f92672">=</span>SANYO
</span></span><span style="display:flex;"><span>POWER_SUPPLY_SERIAL_NUMBER<span style="color:#f92672">=</span><span style="color:#ae81ff">15921</span>
</span></span></code></pre></div><h3 id="backlight">Backlight</h3>
<p><code>/sys/class/backlight/</code> 目录下的是背光设备，如显示屏，背光键盘等，可以更改文件内容来调节这些设备的亮度。如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ ls /sys/class/backlight/intel_backlight/
</span></span><span style="display:flex;"><span>actual_brightness  bl_power  brightness  device@  max_brightness  power/  subsystem@  type  uevent
</span></span></code></pre></div><ul>
<li>
<p><strong>brightness</strong></p>
<p>更改这个文件可以修改此设备的当前亮度</p>
</li>
<li>
<p><strong>max_brightness</strong></p>
<p>这个文件显示的是此设备支持的最大亮度</p>
</li>
</ul>
<p>另外背光设备 <code>device</code> 可能只想真实的显卡设备，一般是子目录中包含 <code>video</code> 的。</p>
<h3 id="camera">Camera</h3>
<p><code>/sys/class/video4linux/</code> 下是摄像头设备，不同子目录中的设备可能是同一个，也是读取 <code>device/uevent</code> 文件来选择 <code>lspci</code> 或 <code>lsusb</code> 获取设备信息，如：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ cat /sys/class/video4linux/video0/device/uevent
</span></span><span style="display:flex;"><span>DEVTYPE<span style="color:#f92672">=</span>usb_interface
</span></span><span style="display:flex;"><span>DRIVER<span style="color:#f92672">=</span>uvcvideo
</span></span><span style="display:flex;"><span>PRODUCT<span style="color:#f92672">=</span>5986/2d2/11
</span></span><span style="display:flex;"><span>TYPE<span style="color:#f92672">=</span>239/2/1
</span></span><span style="display:flex;"><span>INTERFACE<span style="color:#f92672">=</span>14/1/0
</span></span><span style="display:flex;"><span>MODALIAS<span style="color:#f92672">=</span>usb:v5986p02D2d0011dcEFdsc02dp01ic0Eisc01ip00in00
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>$ lsusb -d 5986:2d2:11
</span></span><span style="display:flex;"><span>Bus <span style="color:#ae81ff">001</span> Device 004: ID 5986:02d2 Acer, Inc
</span></span></code></pre></div><h3 id="printer">Printer</h3>
<p>打印机应该是在 <code>/sys/class/printer</code> 下，信息获取方法应该与上文一致，本人手中没有打印机就不给出示例了。</p>
<h3 id="fingerprint">Fingerprint</h3>
<p>指纹的功能目前是由 <code>libfprint</code> 项目提供，调用其提供的接口来获取。</p>
<p>如使用 <code>qdbus</code> 来获取：</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ qdbus --system --literal net.reactivated.Fprint /net/reactivated/Fprint/Manager net.reactivated.Fprint.Manager.GetDevices
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>Argument: ao <span style="color:#f92672">{}]</span>
</span></span></code></pre></div><p>输出可知本机没有指纹设备。</p>
<h2 id="实现">实现</h2>
<p>这里用 <code>Go</code> 实现了 <code>hardware</code> ，见此： <a href="https://github.com/jouyouyun/hardware">hardware</a></p><ul class="pa0">
  
   <li class="list di">
     <a href="/tags/hardware" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">hardware</a>
   </li>
  
   <li class="list di">
     <a href="/tags/cpu" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">cpu</a>
   </li>
  
   <li class="list di">
     <a href="/tags/disk" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">disk</a>
   </li>
  
   <li class="list di">
     <a href="/tags/network" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">network</a>
   </li>
  
   <li class="list di">
     <a href="/tags/wireless" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">wireless</a>
   </li>
  
   <li class="list di">
     <a href="/tags/wired" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">wired</a>
   </li>
  
   <li class="list di">
     <a href="/tags/memory" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">memory</a>
   </li>
  
   <li class="list di">
     <a href="/tags/dmi" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">dmi</a>
   </li>
  
   <li class="list di">
     <a href="/tags/bios" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">bios</a>
   </li>
  
   <li class="list di">
     <a href="/tags/board" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">board</a>
   </li>
  
   <li class="list di">
     <a href="/tags/lsblk" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">lsblk</a>
   </li>
  
   <li class="list di">
     <a href="/tags/lspci" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">lspci</a>
   </li>
  
   <li class="list di">
     <a href="/tags/lsusb" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">lsusb</a>
   </li>
  
   <li class="list di">
     <a href="/tags/lshw" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">lshw</a>
   </li>
  
   <li class="list di">
     <a href="/tags/dmidecode" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">dmidecode</a>
   </li>
  
</ul>
<div class="mt6 instapaper_ignoref">
      
      
      </div>
    </div>

    <aside class="w-30-l mt6-l">




</aside>

  </article>

    </main>
    <footer class="bg-black bottom-0 w-100 pa3" role="contentinfo">
  <div class="flex justify-between">
  <a class="f4 fw4 hover-white no-underline white-70 dn dib-ns pv2 ph3" href="https://jouyouyun.github.io" >
    &copy;  jouyouyun 2023 
  </a>
    <div>
<div class="ananke-socials">
  
    <a href="https://github.com/jouyouyun" target="_blank" class="github ananke-social-link link-transition stackoverflow link dib z-999 pt3 pt0-l mr1" title="GitHub link" rel="noopener" aria-label="follow on GitHub——Opens in a new window">
      
        <span class="icon"><svg style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512"  xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
  <path d="M256,32C132.3,32,32,134.8,32,261.7c0,101.5,64.2,187.5,153.2,217.9c11.2,2.1,15.3-5,15.3-11.1   c0-5.5-0.2-19.9-0.3-39.1c-62.3,13.9-75.5-30.8-75.5-30.8c-10.2-26.5-24.9-33.6-24.9-33.6c-20.3-14.3,1.5-14,1.5-14   c22.5,1.6,34.3,23.7,34.3,23.7c20,35.1,52.4,25,65.2,19.1c2-14.8,7.8-25,14.2-30.7c-49.7-5.8-102-25.5-102-113.5   c0-25.1,8.7-45.6,23-61.6c-2.3-5.8-10-29.2,2.2-60.8c0,0,18.8-6.2,61.6,23.5c17.9-5.1,37-7.6,56.1-7.7c19,0.1,38.2,2.6,56.1,7.7   c42.8-29.7,61.5-23.5,61.5-23.5c12.2,31.6,4.5,55,2.2,60.8c14.3,16.1,23,36.6,23,61.6c0,88.2-52.4,107.6-102.3,113.3   c8,7.1,15.2,21.1,15.2,42.5c0,30.7-0.3,55.5-0.3,63c0,6.1,4,13.3,15.4,11C415.9,449.1,480,363.1,480,261.7   C480,134.8,379.7,32,256,32z"/>
</svg>
</span>
      
<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000"  xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;"/>
</svg>
</span></a>
  
</div>
</div>
  </div>
</footer>

  </body>
</html>
